<?php

/**
 * This is the model class for table "{{gz}}".
 *
 * The followings are the available columns in table '{{gz}}':
 * @property integer $id
 * @property string $ghcode
 * @property string $name
 * @property integer $year
 * @property integer $month
 * @property string $bzgz
 * @property string $mqdays
 * @property string $cqdays
 * @property string $jbgz
 * @property string $gljsr
 * @property string $gljs
 * @property string $glbt
 * @property string $yfugz
 * @property string $cb
 * @property string $db
 * @property string $tf
 * @property string $nb
 * @property string $yfagz
 * @property string $sxjs
 * @property string $hkxz
 * @property string $hlxz
 * @property string $yalbx
 * @property string $sybx
 * @property string $ybjs
 * @property string $yilbx
 * @property string $gjjjs
 * @property string $gjj
 * @property string $ynssde
 * @property string $fjjhbk
 * @property string $gs
 * @property string $hdjf
 * @property string $sfgz
 * @property integer $tmpi1
 * @property integer $tmpi2
 * @property integer $tmpi3
 * @property integer $tmpi4
 * @property integer $tmpi5
 * @property integer $tmpi6
 * @property integer $tmpi7
 * @property integer $tmpi8
 * @property integer $tmpi9
 * @property string $tmps1
 * @property string $tmps2
 * @property string $tmps3
 * @property string $tmps4
 * @property string $tmps5
 * @property string $tmps6
 * @property string $tmps7
 * @property string $tmps8
 * @property string $tmps9
 */
class Gz extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{gz}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('year, month, tmpi1, tmpi2, tmpi3, tmpi4, tmpi5, tmpi6, tmpi7, tmpi8, tmpi9', 'numerical', 'integerOnly'=>true),
			array('ghcode, name, bzgz, mqdays, cqdays, jbgz, gljsr, gljs, glbt, yfugz, cb, db, tf, nb, yfagz, sxjs, hkxz, hlxz, yalbx, sybx, ybjs, yilbx, gjjjs, gjj, ynssde, fjjhbk, gs, hdjf, sfgz, tmps1, tmps2, tmps4, tmps5, tmps6, tmps7, tmps8, tmps9', 'length', 'max'=>20),
            array('tmps3', 'length', 'max'=>50),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id, ghcode, name, year, month, bzgz, mqdays, cqdays, jbgz, gljsr, gljs, glbt, yfugz, cb, db, tf, nb, yfagz, sxjs, hkxz, hlxz, yalbx, sybx, ybjs, yilbx, gjjjs, gjj, ynssde, fjjhbk, gs, hdjf, sfgz, tmpi1, tmpi2, tmpi3, tmpi4, tmpi5, tmpi6, tmpi7, tmpi8, tmpi9, tmps1, tmps2, tmps3, tmps4, tmps5, tmps6, tmps7, tmps8, tmps9', 'safe', 'on'=>'search'),
             array('tmps1', 'file', 'types' => 'csv',  'maxSize'=>5242880,
                   'allowEmpty' => true,
                   'wrongType'=>'Only csv allowed.',
                   'tooLarge'=>'File too large! 5MB is the limit'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'ghcode' => '工号',
			'name' => '姓名',
			'year' => '年',
			'month' => '月',
			'bzgz' => '标准工资',
			'mqdays' => '满勤天数',
			'cqdays' => '出勤天数',
			'jbgz' => '本月基本工资',
			'gljsr' => '工龄计算日',
			'gljs' => '工龄计算',
			'glbt' => '工龄补贴',
			'yfugz' => '应付工资',
			'cb' => '车补',
			'db' => '独补',
			'tf' => '托补',
			'nb' => '女补',
			'yfagz' => '应发工资',
			'sxjs' => '三险基数',
			'hkxz' => '户口性质',
			'hlxz' => '户粮性质',
			'yalbx' => '养老保险',
			'sybx' => '失业保险',
			'ybjs' => '医保基数',
			'yilbx' => '医疗保险',
			'gjjjs' => '公积金基数',
			'gjj' => '公积金',
			'ynssde' => '应纳税所得额',
			'fjjhbk' => '发奖金合并扣额',
			'gs' => '个税',
			'hdjf' => '活动经费',
			'sfgz' => '实发工资',
			'tmpi1' => '帐号后四位',
			'tmpi2' => '身份证后四位',
			'tmpi3' => 'Tmpi3',
			'tmpi4' => 'Tmpi4',
			'tmpi5' => 'Tmpi5',
			'tmpi6' => 'Tmpi6',
			'tmpi7' => 'Tmpi7',
			'tmpi8' => 'Tmpi8',
			'tmpi9' => 'Tmpi9',
			'tmps1' => '公司',
			'tmps2' => '部门',
			'tmps3' => '微信号',
			'tmps4' => '病事假扣款',
			'tmps5' => '补款',
			'tmps6' => '其他扣款',
			'tmps7' => '技能津贴',
			'tmps8' => '奖金',
			'tmps9' => 'Tmps9',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('ghcode',$this->ghcode,true);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('year',$this->year);
		$criteria->compare('month',$this->month);
		$criteria->compare('bzgz',$this->bzgz,true);
		$criteria->compare('mqdays',$this->mqdays,true);
		$criteria->compare('cqdays',$this->cqdays,true);
		$criteria->compare('jbgz',$this->jbgz,true);
		$criteria->compare('gljsr',$this->gljsr,true);
		$criteria->compare('gljs',$this->gljs,true);
		$criteria->compare('glbt',$this->glbt,true);
		$criteria->compare('yfugz',$this->yfugz,true);
		$criteria->compare('cb',$this->cb,true);
		$criteria->compare('db',$this->db,true);
		$criteria->compare('tf',$this->tf,true);
		$criteria->compare('nb',$this->nb,true);
		$criteria->compare('yfagz',$this->yfagz,true);
		$criteria->compare('sxjs',$this->sxjs,true);
		$criteria->compare('hkxz',$this->hkxz,true);
		$criteria->compare('hlxz',$this->hlxz,true);
		$criteria->compare('yalbx',$this->yalbx,true);
		$criteria->compare('sybx',$this->sybx,true);
		$criteria->compare('ybjs',$this->ybjs,true);
		$criteria->compare('yilbx',$this->yilbx,true);
		$criteria->compare('gjjjs',$this->gjjjs,true);
		$criteria->compare('gjj',$this->gjj,true);
		$criteria->compare('ynssde',$this->ynssde,true);
		$criteria->compare('fjjhbk',$this->fjjhbk,true);
		$criteria->compare('gs',$this->gs,true);
		$criteria->compare('hdjf',$this->hdjf,true);
		$criteria->compare('sfgz',$this->sfgz,true);
		$criteria->compare('tmpi1',$this->tmpi1);
		$criteria->compare('tmpi2',$this->tmpi2);
		$criteria->compare('tmpi3',$this->tmpi3);
		$criteria->compare('tmpi4',$this->tmpi4);
		$criteria->compare('tmpi5',$this->tmpi5);
		$criteria->compare('tmpi6',$this->tmpi6);
		$criteria->compare('tmpi7',$this->tmpi7);
		$criteria->compare('tmpi8',$this->tmpi8);
		$criteria->compare('tmpi9',$this->tmpi9);
		$criteria->compare('tmps1',$this->tmps1,true);
		$criteria->compare('tmps2',$this->tmps2,true);
		$criteria->compare('tmps3',$this->tmps3,true);
		$criteria->compare('tmps4',$this->tmps4,true);
		$criteria->compare('tmps5',$this->tmps5,true);
		$criteria->compare('tmps6',$this->tmps6,true);
		$criteria->compare('tmps7',$this->tmps7,true);
		$criteria->compare('tmps8',$this->tmps8,true);
		$criteria->compare('tmps9',$this->tmps9,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return Gz the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
